home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1432.dms / var1432.adf / NDUK-V40.lha / V40 / include / devices / scsidisk.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  4KB  |  118 lines

  1. #ifndef    DEVICES_SCSIDISK_H
  2. #define    DEVICES_SCSIDISK_H
  3. /*
  4. **    $VER: scsidisk.h 36.2 (7.11.90)
  5. **    Includes Release 40.15
  6. **
  7. **    SCSI exec-level device command
  8. **
  9. **    (C) Copyright 1988-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include "exec/types.h"
  16. #endif /* EXEC_TYPES_H */
  17.  
  18.  
  19.  
  20. /*--------------------------------------------------------------------
  21.  *
  22.  *   SCSI Command
  23.  *    Several Amiga SCSI controller manufacturers are converging on
  24.  *    standard ways to talk to their controllers.  This include
  25.  *    file describes an exec-device command (e.g. for hddisk.device)
  26.  *    that can be used to issue SCSI commands
  27.  *
  28.  *   UNIT NUMBERS
  29.  *    Unit numbers to the OpenDevice call have encoded in them which
  30.  *    SCSI device is being referred to.  The three decimal digits of
  31.  *    the unit number refer to the SCSI Target ID (bus address) in
  32.  *    the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  33.  *    and the controller board in the 100's digit.
  34.  *
  35.  *    Examples:
  36.  *          0    drive at address 0
  37.  *         12    LUN 1 on multiple drive controller at address 2
  38.  *        104    second controller board, address 4
  39.  *         88    not valid: both logical units and addresses
  40.  *            range from 0..7.
  41.  *
  42.  *   CAVEATS
  43.  *    Original 2090 code did not support this command.
  44.  *
  45.  *    Commodore 2090/2090A unit numbers are different.  The SCSI
  46.  *    logical unit is the 100's digit, and the SCSI Target ID
  47.  *    is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  48.  *    (7 is reserved for the controller).
  49.  *
  50.  *        Examples:
  51.  *          3    drive at address 0
  52.  *        109    drive at address 6, logical unit 1
  53.  *          1    not valid: this is not a SCSI unit.  Perhaps
  54.  *            it's an ST506 unit.
  55.  *
  56.  *    Some controller boards generate a unique name (e.g. 2090A's
  57.  *    iddisk.device) for the second controller board, instead of
  58.  *    implementing the 100's digit.
  59.  *
  60.  *    There are optional restrictions on the alignment, bus
  61.  *    accessability, and size of the data for the data phase.
  62.  *    Be conservative to work with all manufacturer's controllers.
  63.  *
  64.  *------------------------------------------------------------------*/
  65.  
  66. #define    HD_SCSICMD    28    /* issue a SCSI command to the unit */
  67.                 /* io_Data points to a SCSICmd */
  68.                 /* io_Length is sizeof(struct SCSICmd) */
  69.                 /* io_Actual and io_Offset are not used */
  70.  
  71. struct SCSICmd {
  72.     UWORD  *scsi_Data;        /* word aligned data for SCSI Data Phase */
  73.                 /* (optional) data need not be byte aligned */
  74.                 /* (optional) data need not be bus accessable */
  75.     ULONG   scsi_Length;    /* even length of Data area */
  76.                 /* (optional) data can have odd length */
  77.                 /* (optional) data length can be > 2**24 */
  78.     ULONG   scsi_Actual;    /* actual Data used */
  79.     UBYTE  *scsi_Command;    /* SCSI Command (same options as scsi_Data) */
  80.     UWORD   scsi_CmdLength;    /* length of Command */
  81.     UWORD   scsi_CmdActual;    /* actual Command used */
  82.     UBYTE   scsi_Flags;        /* includes intended data direction */
  83.     UBYTE   scsi_Status;    /* SCSI status of command */
  84.     UBYTE  *scsi_SenseData;    /* sense data: filled if SCSIF_[OLD]AUTOSENSE */
  85.                 /* is set and scsi_Status has CHECK CONDITION */
  86.                 /* (bit 1) set */
  87.     UWORD   scsi_SenseLength;    /* size of scsi_SenseData, also bytes to */
  88.                 /* request w/ SCSIF_AUTOSENSE, must be 4..255 */
  89.     UWORD   scsi_SenseActual;    /* amount actually fetched (0 means no sense) */
  90. };
  91.  
  92.  
  93. /*----- scsi_Flags -----*/
  94. #define    SCSIF_WRITE        0    /* intended data direction is out */
  95. #define    SCSIF_READ        1    /* intended data direction is in */
  96. #define    SCSIB_READ_WRITE    0    /* (the bit to test) */
  97.  
  98. #define    SCSIF_NOSENSE        0    /* no automatic request sense */
  99. #define    SCSIF_AUTOSENSE        2    /* do standard extended request sense */
  100.                     /* on check condition */
  101. #define    SCSIF_OLDAUTOSENSE    6    /* do 4 byte non-extended request */
  102.                     /* sense on check condition */
  103. #define    SCSIB_AUTOSENSE        1    /* (the bit to test) */
  104. #define    SCSIB_OLDAUTOSENSE    2    /* (the bit to test) */
  105.  
  106. /*----- SCSI io_Error values -----*/
  107. #define    HFERR_SelfUnit        40    /* cannot issue SCSI command to self */
  108. #define    HFERR_DMA        41    /* DMA error */
  109. #define    HFERR_Phase        42    /* illegal or unexpected SCSI phase */
  110. #define    HFERR_Parity        43    /* SCSI parity error */
  111. #define    HFERR_SelTimeout    44    /* Select timed out */
  112. #define    HFERR_BadStatus        45    /* status and/or sense error */
  113.  
  114. /*----- OpenDevice io_Error values -----*/
  115. #define    HFERR_NoBoard        50    /* Open failed for non-existant board */
  116.  
  117. #endif    /* DEVICES_SCSIDISK_H */
  118.